part of '../repository.dart';

class _WebSavedPaymentMethodGettingSuccessfulResponseDto {
  const _WebSavedPaymentMethodGettingSuccessfulResponseDto._internal({
    required this.savedPaymentMethodDtos,
  });

  final BuiltList<_WebPaymentMethodDto> savedPaymentMethodDtos;

  factory _WebSavedPaymentMethodGettingSuccessfulResponseDto.fromJson(Map<String, dynamic> json) {
    final savedPaymentMethodMaps = List.castFrom<dynamic, Map>(json['web_saved_payment_methods']);

    final savedPaymentMethodDtos = savedPaymentMethodMaps.map((paymentMethodMap) {
      final paymentMethodJson = Map.castFrom<dynamic, dynamic, String, dynamic>(paymentMethodMap);
      final paymentMethodDto = _WebPaymentMethodDtoFactory().fromJson(paymentMethodJson);
      return paymentMethodDto;
    }).toBuiltList();

    return _WebSavedPaymentMethodGettingSuccessfulResponseDto._internal(
      savedPaymentMethodDtos: savedPaymentMethodDtos,
    );
  }
}
